package com.xmh.reptile.service.impl;

import java.util.List;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xmh.reptile.dao.VideoDAO;
import com.xmh.reptile.entity.VideoEntity;
import com.xmh.reptile.service.VideoService;

@Service
public class VideoServiceImpl implements VideoService {

	@Autowired
	private VideoDAO dao;

	private Logger logger = LoggerFactory.getLogger(VideoServiceImpl.class);

	@Override
	public Map<String, Object> add(VideoEntity video) {
		dao.add(video);
		return successMessages();
	}

	@Override
	public Map<String, Object> delete(VideoEntity video) {
		dao.delete(video);
		return successMessages();
	}

	@Override
	public Map<String, Object> update(VideoEntity video) {
		dao.update(video);
		return successMessages();
	}

	@Override
	public List<VideoEntity> selectList(Map<String, Object> jsonMap) {
		return dao.selectList(jsonMap);
	}

	@Override
	public VideoEntity get(VideoEntity video) {
		return dao.get(video);
	}

	/**
	 * 返回成功提示
	 * 
	 * @return
	 */
	private Map<String, Object> successMessages() {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("code", "200");
		map.put("msg", "成功");
		return map;
	}

}
